package com.lin.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.blog.entity.ArticleTags;
import com.lin.blog.entity.RolePermission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lin
 * @since 2020-03-08
 */
public interface RolePermissionMapper extends BaseMapper<RolePermission> {

    /**
     * 通过roleId获取 RolePermissionList
     * @param roleId
     * @return
     */
    @Select(" SELECT * FROM role_permission where role_id = #{roleId}")
    public List<RolePermission> listRolePermissionByRoleId(Long roleId);


    /**
     * 根据roleId permissionList 拼接SQL批量删除
     * @param roleId
     * @param permissionList
     * @return
     */
    public int deleteBatch(@Param("roleId") Long roleId, @Param("permissionList") List<Long> permissionList);


    /**
     * 根据roleId permissionList 拼接SQL批量添加
     * @param roleId
     * @param permissionList
     * @return
     */
    public int insertBatch(@Param("roleId") Long roleId, @Param("permissionList") List<Long> permissionList);

}
